"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = UploadExample;

var _react = _interopRequireDefault(require("react"));

var _design = require("@discuzq/design");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function UploadExample() {
  var post = function post(file, list, updater) {
    return new Promise(function (relsove) {
      var interval = setInterval(function () {
        file.status = 'uploading';
        file.percent += 10;
        updater(list);
      }, 1000);
      setTimeout(function () {
        clearInterval(interval);
        relsove(false);

        _design.Toast.error({
          content: '上传失败'
        });
      }, 6000);
    });
  };

  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_design.Upload, {
    customRequest: post
  }, /*#__PURE__*/_react.default.createElement(_design.Button, {
    type: "text",
    style: {
      display: 'flex',
      alignItems: 'center'
    }
  }, /*#__PURE__*/_react.default.createElement(_design.Icon, {
    name: "PlusOutlined",
    size: 14
  }), "\u4E0A\u4F20\u9644\u4EF6")));
}